package com.stars.easyms.base.alarm;

import com.stars.easyms.base.bean.LazyLoadBean;

/**
 * <p>className: EasyMsAlarmAssistor</p>
 * <p>description: EasyMs告警辅助类：可以实现自定义的告警功能，如果不自定义可以使用easy-ms-alarm</p>
 *
 * @author guoguifang
 * @version 1.7.1
 * @date 2020/12/9 1:26 下午
 */
public final class EasyMsAlarmAssistor {

    private static final LazyLoadBean<SendAlarmMessageService> SEND_ALARM_MESSAGE_SERVICE_LAZY_LOAD_BEAN =
            new LazyLoadBean<>(SendAlarmMessageService.class, () -> SendAlarmMessageService.DEFAULT);

    public static void sendExceptionAlarmMessage(Throwable throwable) {
        SEND_ALARM_MESSAGE_SERVICE_LAZY_LOAD_BEAN.accept(s -> s.sendExceptionAlarmMessage(throwable));
    }

    public static void sendNormalAlarmMessage(String message) {
        SEND_ALARM_MESSAGE_SERVICE_LAZY_LOAD_BEAN.accept(s -> s.sendNormalAlarmMessage(message));
    }

    private EasyMsAlarmAssistor() {
    }
}
